package com.traveldream.entities;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the booking database table.
 * 
 */
@Embeddable
public class BookingPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(name="customer_email", insertable=false, updatable=false)
	private String customerEmail;

	@Column(name="packet_id", insertable=false, updatable=false)
	private int packetId;

	public BookingPK() {
	}
	public String getCustomerEmail() {
		return this.customerEmail;
	}
	public void setCustomerEmail(String customerEmail) {
		this.customerEmail = customerEmail;
	}
	public int getPacketId() {
		return this.packetId;
	}
	public void setPacketId(int packetId) {
		this.packetId = packetId;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof BookingPK)) {
			return false;
		}
		BookingPK castOther = (BookingPK)other;
		return 
			this.customerEmail.equals(castOther.customerEmail)
			&& (this.packetId == castOther.packetId);
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.customerEmail.hashCode();
		hash = hash * prime + this.packetId;
		
		return hash;
	}
}